<?php

/** Process Tag cloud links
 *
 * @author natio (www.raybenc.com)
 * @param string Tags
 * @param string Links if needed
 * @return string
 */
function smarty_modifier_tags($sString, $sLink = '')
{
	$oBan = &App::getModuleService('Site', 'Ban');

	$aReplace = array
	(
		'(',
		')',
		',',
		'!',
		'?',
		'/',
		'>',
		'<',
		':'
	);	
	
	$sContent = "";
	$aTags = explode(" ", $sString);
	foreach($aTags as $sTag)
	{
		if ( !empty($sTag) )
		{
			$sTag = strip_tags($sTag);
			$sTag = $oBan->parseStringForBadwords($sTag);
			$sTag = ucwords(str_replace($aReplace, '', $sTag));
			if (substr($sTag, -1) == '.')
			{
				$sTag = rtrim($sTag, '.');
			}			
			$sTagLink = str_replace('.', '-point-', $sTag);
			$sContent .= ' <a href="'. App::makeUrl($sLink, array('tag' => App::cleanUrl($sTagLink, false))) .'">'. $sTag .'</a> ';
		}
	}
    return $sContent;
}

?>